﻿using System;
using System.Linq;
using WebExam.DataEntities;

namespace WebExam.DataProvider
{
    public interface IKMRepository
    {

        /// <summary>
        /// 获取科目信息
        /// </summary>
        /// <param name="start">开始位置</param>
        /// <param name="takeSize">获取条数</param>
        IQueryable<KM> GetAll(int start, int takeSize);

        /// <summary>
        /// 获取科目信息
        /// </summary>
        /// <param name="kmId">科目Id</param>
        KM Get(int kmId);

        /// <summary>
        /// 添加科目信息
        /// </summary>
        /// <param name="km">科目对象</param>
        KM Add(KM km);

        /// <summary>
        /// 更新科目信息
        /// </summary>
        /// <param name="kmId">科目Id</param>
        /// <param name="update">包含更新操作的方法</param>
        KM Update(int kmId, Action<KM> update);

        /// <summary>
        /// 删除科目信息
        /// </summary>
        /// <param name="kmId">科目Id</param>
        bool Delete(int kmId);

        /// <summary>
        /// 统计科目条数
        /// </summary>
        int Count();
    }
}